Clover coverage report - Enterprise Web Services - 1.0
Coverage timestamp: Mon May 30 2005 17:10:32 CEST
file stats: LOC: 245   Methods: 16
NCLOC: 144   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
Ws4J2eeCLOptionParser.java 66.7% 45.2% 37.5% 45.3%
coverage coverage
 1   
 /*
 2   
  * Copyright 2001-2004 The Apache Software Foundation.
 3   
  * 
 4   
  * Licensed under the Apache License, Version 2.0 (the "License");
 5   
  * you may not use this file except in compliance with the License.
 6   
  * You may obtain a copy of the License at
 7   
  * 
 8   
  *      http://www.apache.org/licenses/LICENSE-2.0
 9   
  * 
 10   
  * Unless required by applicable law or agreed to in writing, software
 11   
  * distributed under the License is distributed on an "AS IS" BASIS,
 12   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13   
  * See the License for the specific language governing permissions and
 14   
  * limitations under the License.
 15   
  */
 16   
 
 17   
 package org.apache.geronimo.ews.ws4j2ee.toWs;
 18   
 
 19   
 import org.apache.axis.utils.CLArgsParser;
 20   
 import org.apache.axis.utils.CLOption;
 21   
 import org.apache.axis.utils.CLOptionDescriptor;
 22   
 
 23   
 import java.util.List;
 24   
 
 25   
 /**
 26   
  * @author hemapani
 27   
  */
 28   
 public class Ws4J2eeCLOptionParser {
 29   
     // Define our short one-letter option identifiers.
 30   
     protected static final int SERVER_OPT = 's';
 31   
     protected static final int SKELETON_DEPLOY_OPT = 'S';
 32   
     protected static final int NAMESPACE_OPT = 'N';
 33   
     protected static final int NAMESPACE_FILE_OPT = 'f';
 34   
     protected static final int OUTPUT_OPT = 'o';
 35   
     protected static final int SCOPE_OPT = 'd';
 36   
     protected static final int TEST_OPT = 't';
 37   
     protected static final int PACKAGE_OPT = 'p';
 38   
     protected static final int ALL_OPT = 'a';
 39   
     protected static final int TYPEMAPPING_OPT = 'T';
 40   
     protected static final int FACTORY_CLASS_OPT = 'F';
 41   
     protected static final int HELPER_CLASS_OPT = 'H';
 42   
     protected static final int USERNAME_OPT = 'U';
 43   
     protected static final int PASSWORD_OPT = 'P';
 44   
     protected static final int IMPL_STYLE_OPT = 'E';
 45   
     protected static final int CONTAINER_OPT = 'J';
 46   
 
 47   
     private String wscffile;
 48   
     private String outputDirectory = ".";
 49   
     private boolean isServerSide = false;
 50   
     private String userName;
 51   
     private String password;
 52   
     private String implStyle = GenerationConstants.USE_LOCAL_AND_REMOTE;
 53   
     private String contanier = GenerationConstants.JBOSS_CONTAINER;
 54   
 
 55   
     protected static final CLOptionDescriptor[] options = new CLOptionDescriptor[]{
 56   
         new CLOptionDescriptor("server-side",
 57   
                 CLOptionDescriptor.ARGUMENT_OPTIONAL,
 58   
                 SERVER_OPT,
 59   
                 "Genarate Server side codes"),
 60   
         new CLOptionDescriptor("output",
 61   
                 CLOptionDescriptor.ARGUMENT_REQUIRED,
 62   
                 OUTPUT_OPT,
 63   
                 "output Directory "),
 64   
         new CLOptionDescriptor("user",
 65   
                 CLOptionDescriptor.ARGUMENT_REQUIRED,
 66   
                 USERNAME_OPT,
 67   
                 "user name"),
 68   
         new CLOptionDescriptor("password",
 69   
                 CLOptionDescriptor.ARGUMENT_REQUIRED,
 70   
                 PASSWORD_OPT,
 71   
                 "password"),
 72   
         new CLOptionDescriptor("implStyle",
 73   
                 CLOptionDescriptor.ARGUMENT_REQUIRED,
 74   
                 IMPL_STYLE_OPT,
 75   
                 "impelemtation Style"),
 76   
         new CLOptionDescriptor("container",
 77   
                 CLOptionDescriptor.ARGUMENT_REQUIRED,
 78   
                 CONTAINER_OPT,
 79   
                 "the J2EE contianer")
 80   
     };
 81   
 
 82  4
     public Ws4J2eeCLOptionParser(String[] args) {
 83  4
         CLArgsParser argsParser = new CLArgsParser(args, options);
 84   
 
 85   
         // Print parser errors, if any
 86  4
         if (null != argsParser.getErrorString()) {
 87  0
             System.err.println(argsParser.getErrorString());
 88   
             //printUsage();
 89   
         }
 90   
 
 91   
         // Get a list of parsed options
 92  4
         List clOptions = argsParser.getArguments();
 93  4
         int size = clOptions.size();
 94  4
         try {
 95   
             // Parse the options and configure the emitter as appropriate.
 96  4
             for (int i = 0; i < size; i++) {
 97  9
                 parseOption((CLOption) clOptions.get(i));
 98   
             }
 99   
 
 100   
             // validate argument combinations
 101   
             //
 102   
             //validateOptions();
 103   
 
 104   
             //parser.run(wsdlURI);
 105   
 
 106   
             // everything is good
 107   
             //System.exit(0);
 108   
         } catch (Throwable t) {
 109  0
             t.printStackTrace();
 110  0
             System.exit(1);
 111   
         }
 112   
     }
 113   
 
 114  9
     protected void parseOption(CLOption option) {
 115  9
         switch (option.getId()) {
 116   
             case SERVER_OPT:
 117  0
                 isServerSide = true;
 118  0
                 break;
 119   
             case OUTPUT_OPT:
 120  4
                 outputDirectory = option.getArgument();
 121  4
                 break;
 122   
             case USERNAME_OPT:
 123  0
                 userName = option.getArgument();
 124  0
                 break;
 125   
             case PASSWORD_OPT:
 126  0
                 password = option.getArgument();
 127  0
                 break;
 128   
             case CLOption.TEXT_ARGUMENT:
 129  4
                 if (wscffile != null) {
 130  0
                     throw new UnrecoverableGenerationFault("Only one arguement allowed ");
 131   
                     //printUsage();
 132   
                 }
 133  4
                 wscffile = option.getArgument();
 134  4
                 break;
 135   
             case IMPL_STYLE_OPT:
 136  1
                 this.implStyle = option.getArgument();
 137  1
                 break;
 138   
             case CONTAINER_OPT:
 139  0
                 this.contanier = option.getArgument();
 140  0
                 break;
 141   
             default:
 142  0
                 throw new UnrecoverableGenerationFault("unknown option");
 143   
         }
 144   
     } // parseOption
 145   
 
 146   
     /**
 147   
      * @return
 148   
      */
 149  4
     public String getWscffile() {
 150  4
         return wscffile;
 151   
     }
 152   
 
 153   
     /**
 154   
      * @param string
 155   
      */
 156  0
     public void setWscffile(String string) {
 157  0
         wscffile = string;
 158   
     }
 159   
 
 160   
     /**
 161   
      * @return
 162   
      */
 163  0
     public boolean isServerSide() {
 164  0
         return isServerSide;
 165   
     }
 166   
 
 167   
     /**
 168   
      * @return
 169   
      */
 170  4
     public String getOutputDirectory() {
 171  4
         return outputDirectory;
 172   
     }
 173   
 
 174   
     /**
 175   
      * @return
 176   
      */
 177  0
     public String getPassword() {
 178  0
         return password;
 179   
     }
 180   
 
 181   
     /**
 182   
      * @return
 183   
      */
 184  0
     public String getUserName() {
 185  0
         return userName;
 186   
     }
 187   
 
 188   
     /**
 189   
      * @param b
 190   
      */
 191  0
     public void setServerSide(boolean b) {
 192  0
         isServerSide = b;
 193   
     }
 194   
 
 195   
     /**
 196   
      * @param string
 197   
      */
 198  0
     public void setOutputDirectory(String string) {
 199  0
         outputDirectory = string;
 200   
     }
 201   
 
 202   
     /**
 203   
      * @param string
 204   
      */
 205  0
     public void setPassword(String string) {
 206  0
         password = string;
 207   
     }
 208   
 
 209   
     /**
 210   
      * @param string
 211   
      */
 212  0
     public void setUserName(String string) {
 213  0
         userName = string;
 214   
     }
 215   
 
 216   
     /**
 217   
      * @return
 218   
      */
 219  4
     public String getImplStyle() {
 220  4
         return implStyle;
 221   
     }
 222   
 
 223   
     /**
 224   
      * @param string
 225   
      */
 226  0
     public void setImplStyle(String string) {
 227  0
         implStyle = string;
 228   
     }
 229   
 
 230   
     /**
 231   
      * @return
 232   
      */
 233  4
     public String getContanier() {
 234  4
         return contanier;
 235   
     }
 236   
 
 237   
     /**
 238   
      * @param string
 239   
      */
 240  0
     public void setContanier(String string) {
 241  0
         contanier = string;
 242   
     }
 243   
 
 244   
 }
 245